import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/Home.vue'

const routes: Array<RouteRecordRaw> = [
	{
		path: '/',
		redirect: '/loginAdmin'
	},
	{
		path: '/',
		name: 'HomePage',
		component: () =>
			import(/* webpackChunkName: "about" */ '../views/HomePage.vue')
	},
	{
		path: '/loginAdmin',
		name: 'LoginAdmin',
		component: () =>
			import(/* webpackChunkName: "about" */ '../views/admin/LoginAdmin.vue')
	},
	{
		path: '/login',
		name: 'Login',
		component: () =>
			import(/* webpackChunkName: "about" */ '../views/Login.vue')
	},
	{
		path: '/detailpage',
		name: 'DetailPage',
		component: () =>
			import(/* webpackChunkName: "about" */ '../views/DetailPage.vue')
	},
	{
		path: '/postpage',
		name: 'PostPage',
		component: () =>
			import(/* webpackChunkName: "about" */ '../views/PostPage.vue')
	},
	// admin
	{
		path: '/article',
		name: 'ArticleAdmin',
		component: () =>
			import(/* webpackChunkName: "about" */ '../views/admin/ArticleAdmin.vue')
	},
	{
		path: '/comments',
		name: 'CommentsAdmin',
		component: () =>
			import(/* webpackChunkName: "about" */ '../views/admin/CommentsAdmin.vue')
	},
	{
		path: '/users',
		name: 'UsersAdmin',
		component: () =>
			import(/* webpackChunkName: "about" */ '../views/admin/UsersAdmin.vue')
	}
]

const router = createRouter({
	history: createWebHistory(process.env.BASE_URL),
	routes
})

export default router
